from time import sleep
from timeit import timeit

def slow_operation(number):
    sleep(5)


# timeit(
#     "slow_operation(number) for number in [2,3,4,5,6,2,3,4]"
#     globals=globals(),
#     number = 1,
# )


class Stack:
    def __init__(self):
        self._items = []

    def push(self, item):
        self._items.append(item)

    def pop(self):
        return self._items.pop()


stack = Stack()
# print(stack)

stack.push(1)
stack.push(2)

res = stack.pop()
print(res)

list1 = []
print(type(list1))
list = ['apple','banana']
list.append('oringal')
print(list)
#指定位置插入list = (1,'jack')
list.insert(0,'jack')
print(list)
#推导式增加数据
list_squaers = [x**2 for x in range(10)]
print(list_squaers)
list_even_number = [x for x in range(10) if x %2 ==0]
print(list_even_number)
#删除list数据
list.remove('banana') #删除列表中第一个值为b的元素，如果不存在则抛出ValueError，全字匹配
print(list)
#pop，删除并返回指定位置的元素，默认删除最后一个元素
list.pop(1)
print(list)
print(f"被删除数据是：{list.pop()}") #不给索引值，默认删除最后一个
#del语句
del list[0]#删除第一个语句
del list[1:3]#删除索引1到3的数据，不包括3

dict = {}
print(type(dict))
tuple1 = ()
print(type(tuple1))

